﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Private.Master" Inherits="System.Web.Mvc.ViewPage" %>

<%@ Import Namespace="WebHoiChoMuaBan.Controllers.Global" %>
<%@ Import Namespace="WebHoiChoMuaBan.Models" %>
<%@ Import Namespace="WebHoiChoMuaBan.Controllers.Helpers" %>
<asp:Content ID="Content2" ContentPlaceHolderID="TitleHolder" runat="server">
    Trang cá nhân
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadHolder" runat="server">
    <script type="text/javascript">
        function ShowOrHide_PostingHotNews(status) {
            if (status == "show") {
                $(".private_info_product").show();
            }
            else if (status == "hide") {
                $(".private_info_product").hide();
            }
            return false;
        }

        $(document).ready(function () {
            //Khi load trang mặc định che giấu phần up tin hot
            $(".private_info_product").hide();

        });
        
    </script>
    <script type="text/javascript">
        var map;
        function initialize(name, image) {
            var myLatlng = new google.maps.LatLng(10.790141, 106.633301);
            var myOptions = {
                zoom: 16,
                center: myLatlng,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            var des1 = document.getElementById("memAddLat").innerText;
            var des2 = document.getElementById("memAddLong").innerText;
            var des = new google.maps.LatLng(des1, des2);
            map = new google.maps.Map(document.getElementById('map_canvas'), myOptions);
            if (navigator.geolocation) {
                navigator.geolocation.getCurrentPosition(function (position) {
                    var pos = new google.maps.LatLng(position.coords.latitude,
            position.coords.longitude);
                    var infowindow = new google.maps.InfoWindow({
                        map: map,
                        position: des,
                        content: "<b style='color:#00F'>" + name + "</b> <br/>" + "<img src='/../Content/Images/Upload/" + image + "' height='70' width='50' />"
                    });
                    map.setCenter(des);
                    handleNoGeolocation(true);
                });
            }
            else {
                handleNoGeolocation(false);
            }
        }

        function handleNoGeolocation(errorFlag) {
            if (errorFlag) {
                var content = 'Quá trình tìm kiếm địa điểm của bạn không thể thực hiện.';
            }
            else {
                var content = 'Trình duyệt của bạn không hỗ trợ ';
            }
            var infowindow = new google.maps.InfoWindow(options);
            map.setCenter(options.position);
        }
    </script>
    <script type="text/javascript">
        function hasClass(el, name) {
            return new RegExp('(\\s|^)' + name + '(\\s|$)').test(el.className);
        }
        function addClass(el, name) {
            if (!hasClass(el, name)) { el.className += (el.className ? ' ' : '') + name; }
        }
        function removeClass(el, name) {
            if (hasClass(el, name)) {
                el.className = el.className.replace(new RegExp('(\\s|^)' + name + '(\\s|$)'), ' ').replace(/^\s+|\s+$/g, '');
            }
        }
        function RegisterReplyButtonMem(comid) {
            //var formReply = document.getElementById("formReply_" + comid);
            //removeClass(formReply, "hidden");
            $('#formReply_' + comid).show();
        }
        function RegisterReplyButtonMemNews(comid) {
            //var formReply = document.getElementById("formReplyNews_" + comid);
            //removeClass(formReply, "hidden");
            //$('#formReply_'+comid)
        }
    </script>
    <script type="text/javascript">
        function LikeCLick(obj) {
            var sid = $('#LikeButton').data("url");
            var sid = obj;
            $.ajax({
                type: "POST",
                url: "/NewsProduct/Like",
                data: "proId=" + sid,
                success: function (result) {

                    if (result == "null") {
                        alert("Đăng nhập để thích");
                    }
                    else {
                        if (result == "duplicated")
                            alert("Bạn đã thích rồi");
                        else {
                            var ff = document.getElementById("LikeField_" + sid);
                            ff.innerHTML = "Thích: Có " + result + " người thích";

                        }
                    }
                },
                error: function (req, status, error) {
                    alert("Sorry! We could not receive your feedback at this time.");
                }
            });
        }
    </script>
    <%-- <script type="text/javascript">
        function FriendRequest(requesting, requested) {
            var dataString = "requestingId=" + requesting + "&requestdId = " + requested;
            $.ajax({
                type: "POST",
                url: "/Friend/FriendRequest",
                data: dataString,
                success: function (result) {

                    if (result == "true") {
                        alert("Kết bạn thành công");
                    }
                    else {
                        alert("Đang chờ duyệt");
                    }
                },
                error: function (req, status, error) {
                    alert("Sorry! We could not receive your feedback at this time.");
                }
            });
        }
    </script>--%>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContentHolder" runat="server">
    <% var hMem = (MemberHelper)ViewData["hMem"]; %>
    <div class="private_rightbottom_contentleft">
        <div class="private_share_post">
            <div class="private_share_post_top">
                <div class="private_sharepost_menu">
                    <ul>
                        <li><a href="canhan_sp_detail_private.html" class="menu_select">Chia sẽ</a></li>
                        <li><a href="#">Bài viết yêu thích</a></li>
                    </ul>
                </div>
                <%--<div class="private_write_right">
                    <div class="private_bt_newspost">
                        <a href="<%= Url.Action("Create","News", new {uid=Session["MemId"] , p=1} ) %>">
                            <img src="/../Content/Images/icon_newpost.gif">
                            Viết bài mới... </a>
                    </div>
                </div>--%>
                <% 
                    if (Session["MemId"] != null)
                    {
                        //String[] right = ((String)Session["Rights"]).Split(',');
                        //if(right.Contains("1"))
                        if (hMem.Member.MemId == (int)Session["MemId"])
                        {
                %>
                <div class="private_write_right">
                    <div class="private_bt_newspost">
                        <a href="<%= Url.Action("Create","News", new {uid=Session["MemId"] , p=1} ) %>">
                            <img src="/../Content/Images/icon_newpost.gif">
                            Viết bài mới... </a>
                    </div>
                </div>
                <%}
                    }%>
            </div>
            <div class="private_comment_top">
                <%
                
                    var lstNewNews = (List<News>)hMem.getNewNews(1, 5);
                    if (lstNewNews != null && lstNewNews.Count > 0)
                    {
                        var news = lstNewNews[0];
                                             
                %>
                <div class="private_img_post_bt">
                    <img src="/../Content/Images/Upload/Thumbnail/<%=news.NewsThumb %>" alt="" class="private_img_post"
                        width="111" height="111" />
                    <br />
                    <div class="private_button_upload">
                        <%--<img src="/../Content/Images/icon_plus_up.gif" alt="Xem tất cả" />--%>
                        <a href="<%=Url.Action("List", "News", new { uid = hMem.Member.MemId, p=1 })%>" id="private_menu_news">
                            <img src="/../Content/Images/icon_plus_up.gif" alt="Xem tất cả" />
                            Xem tất cả</a>
                    </div>
                </div>
                <div class="private_post_text">
                    <%--<p class="private_text_title"><%=news.NewsTitle %></p>--%>
                    <p class="private_text_title">
                        <%--<a href="<%=Url.Action("Detail", "News", new { uid = hMem.Member.MemId, newsId= news.NewsId, nid = news.NewsTitle })%>">
                            <%=news.NewsTitle %></a>--%>
                        <a href="/News/Detail?uid=<%=hMem.Member.MemId %>&newsId=<%=news.NewsId %>">
                            <%=news.NewsTitle %></a>
                        <p>
                            <p>
                                <%=news.NewsIntro %></p>
                            <br />
                            <span>
                                <img src="/../Content/Images/turnview.gif" />&nbsp;&nbsp;Lượt xem:
                                <%=news.NewsViewCount %></span>&nbsp;&nbsp;&nbsp; <span>
                                    <%--tại đây--%>
                                    <% 
                                        if (Session["MemId"] != null)
                                        {
                                            if (news.MemId != (int)Session["MemId"])
                                            {
                                    %>
                                    <span>
                                        <img src="/../Content/Images/like_bt.gif" />&nbsp;&nbsp;Thích</span>
                                    <% 
                                        }
                                        }
                                    %>
                                    <br />
                                    <hr />
                                    <%
lstNewNews.RemoveAt(0);
foreach (var n in lstNewNews)
{
                                    %>
                                    <a href="<%=Url.Action("Detail", "News", new { uid = hMem.Member.MemId, newsId= n.NewsId, nid = n.NewsTitle,isEditMode="False" })%>">
                                        *<%=n.NewsTitle + " ("+n.NewsDate.ToString("dd/MM") + ")"%></a>
                                    <%
}
                   
                                    %>
                </div>
                <div class="private_bt_delete">
                    <a href="#">
                        <img src="/../Content/Images/delete_bt.gif" alt=""></a></div>
                <%
}
                    else
                    {
                %>
                Chưa có bài viết nào!
                <%
}
                %>
            </div>
        </div>
        <div class="private_share_post">
            <div class="private_share_post_top">
                <div class="private_sharepost_menu">
                    <ul>
                        <li><a href="#" class="menu_select">Lời nhắn</a></li>
                    </ul>
                </div>
                <div class="private_button_left">
                    <div class="private_bt_newspost">
                        <% if (Session["MemId"] != null)
                           { %>
                        <a href="#">
                            <img src="/../Content/Images/icon_newpost.gif" />
                            Viết tin nhắn mới </a>
                    </div>
                        <div>
                    <form action="<%=Url.Action("SendMessage", "Message") %>" method="post" style="margin-top: 15px"
                    class="private_content_comment">
                    <input type="hidden" value="<%=hMem.Member.MemId %>" name="MemId" id="MemId" />
                    <div class="private_menu_topmenu">
                        <textarea class="input_full" rows="5" cols="50" id="txtComment" style="width:550px" name="txtComment"></textarea>
                    </div>
                      <div class="private_post_text">
                    <div style="background-color: white; margin: 10px 0px 10px 0px; width: 550px">
                        <span class="private_font_bold">Chọn icon: </span>
                        <% ChatHelper chat2 = new ChatHelper();
                           List<ChatEmotionDetail> icons2 = chat2.getEmotionPath();
                           foreach (ChatEmotionDetail icon in icons2)
                           {
                               Response.Write("<img align='middle' style='margin:3px' onclick='MemchatIconClick(this)' src='" + icon.path + "' id='" + icon.notation + "' width='30px' height='30px' />");

                           }
                        %>
                    </div>
                    <script type="text/javascript">
                        function MemchatIconClick(obj) {
                            $this = document.getElementById("txtComment");
                            $this.value += obj.id;
                        }
                    </script>
                    <center style="margin: 5px;">
                        <input type="submit" style="width: 60px;" id="Submit1" value="Gửi" class="private_bt_submit_news_disable" />
                    </center>
                      </div>
                    </form>
                </div>
                </div>
                <% }
                           else
                           {
                               Response.Write("</div>");
                               Response.Write("</div>");
                           } 
                %>
                <div style="clear: both">
                </div>
                <div class="private_messages">
                    <%
                        var privateMsg = hMem.getNewMessages(1, 6);
                        foreach (var msg in privateMsg.CommentMembers)
                        {
                            if (msg.ComIdReply == null)
                            {
                    %>
                    <div class="private_content_mg_thumb">
                        <div class="private_img_msg_avatar">
                            <img src="/../Content/Images/Upload/<%=msg.MemberSends.MemAvatar %>" alt="" class="private_img_post"
                                width="48" height="48" />
                        </div>
                        <div class="private_messages_text">
                            <p>
                                <span class="private_user">
                                    <%=msg.MemberSends.MemFullname%>:&nbsp;</span>
                                <%=msg.ComContent%>
                            </p>
                            <br />
                            <div class="private_message_rpbt_delete">
                                <p class="private_timer">
                                    <i>(<%=msg.ComDate.ToString("hh:mm dd/MM/yyyy")%>)</i></p>
                                <div class="private_content_rp">
                                    <%if (Session["MemId"] != null)
                                      {%>
                                    <div style="cursor: pointer">
                                        <span class="private_button_upload" onclick="RegisterReplyButtonMem(<%=msg.ComId %>)">
                                            <img src="/../Content/Images/icon_plus_up.gif" class="btnReply">Trả lời</span></div>
                                </div>
                                <div class="private_messages_delete">
                                    <a href="#">
                                        <img src="/../Content/Images/delete_bt.gif" alt="" /></a></div>
                                <%}
                                      else
                                      {
                                %>
                                Đăng nhập để bình luận</div>
                            <%
                                } %>
                        </div>
                    </div>
                </div>
                <form action="<%=Url.Action("SendMessage", "Message") %>" method="post" id="formReply_<%=msg.ComId %>"
                class="private_content_comment hidden">
                <input type="button" value="đóng" style="margin-left: 400px" class="btnReplyClose_<%=msg.ComId %>"   onclick="CloseRegisterReplyButton(<%=msg.ComId %>)" />
                <input type="hidden" value="<%=hMem.Member.MemId %>" name="MemId" id="Hidden1" />
                <input type="hidden" value="<%=msg.ComId %>" name="IsReplyTo" id="Hidden2" />
                <div class="private_menu_topmenu">
                    <textarea style="margin-left: 20px" class="input_full" rows="5" cols="45" id="txtCommentreply"
                        name="txtComment"></textarea>
                </div>
                <span class="private_font_bold">Trả lời: </span>
                <div style="background-color: white; margin: 10px 0px 10px 0px; width: 600px">
                    <span class="private_font_bold">Chọn icon: </span>
                    <% ChatHelper chat = new ChatHelper();
                       List<ChatEmotionDetail> icons = chat.getEmotionPath();
                       foreach (ChatEmotionDetail icon in icons)
                       {
                           Response.Write("<img align='middle' style='margin:3px' onclick='MemchatIconClick1(this)' src='" + icon.path + "' id='" + icon.notation + "' width='30px' height='30px' />");

                       }
                    %>
                </div>
                <script type="text/javascript">
                    function MemchatIconClick1(obj) {
                        $this = document.getElementById("txtCommentreply");
                        $this.value += obj.id;
                    }
                    function CloseRegisterReplyButton(e) {
                        $('#formReply_' + e).hide();
                    }
                </script>
                <div>
                    <center style="margin: 5px;">
                        <input type="submit" style="width: 60px;" id="Submit2" value="Gửi" class="private_bt_submit_news_disable" />
                    </center>
                </div>
                <br />
                </form>
                <%
                    if (msg.CommentReplies != null && msg.CommentReplies.Count > 0)
                    {
                        foreach (var reply in msg.CommentReplies.AsEnumerable())
                        {
                %>
                <div class="private_content_mg_reply_thumb">
                    <div class="private_img_msg_avatar">
                        <img src="/../Content/Images/Upload/<%=reply.MemberSends.MemAvatar %>" alt="" class="private_img_post"
                            width="48" height="48" />
                    </div>
                    <div class="private_messages_text">
                        <p>
                            <span class="private_user">
                                <%=reply.MemberSends.MemFullname%>:&nbsp;</span>
                            <%=reply.ComContent%>
                        </p>
                        <br />
                        <div class="private_message_rpbt_delete">
                            <p class="private_timer">
                                <i>(<%=reply.ComDate.ToString("hh:mm dd/MM/yyyy")%>)</i></p>
                            <% if (Session["MemId"] != null)
                               {%>
                            <div class="private_messages_delete">
                                <a href="#">
                                    <img src="/../Content/Images/delete_bt.gif" alt="" /></a></div>
                            <%} %>
                        </div>
                    </div>
                </div>
                <%
}
                    }
                            }
                        } 
                %>
            </div>
            <div class="private_friend_footer">
                <a href="<%=Url.Action("List", "Message", new { uid = hMem.Member.MemId })%>">Xem tất
                    cả</a></div>
        </div>
        <!-- Danh mục sản phẩm -->
        <div class="private_share_post">
            <div class="private_share_post_top">
                <div class="private_sharepost_menu">
                    <ul>
                        <li><a href="#" class="menu_select">Danh mục sản phẩm</a></li>
                        <li><a href="#">Sản phẩm yêu thích</a></li>
                    </ul>
                </div>
                <% if (Session["MemId"] != null)
                   {
                       if (hMem.Member.MemId == (int)Session["MemId"])
                       {%>
                <div class="private_write_right">
                    <div class="private_bt_newspost">
                        <%--<a href="<%= Url.Action("Index","Home", new { uid = ViewData["MemId"], isEditMode = true}) %>">--%>
                        <a href="<%=Url.RouteUrl("PrivateDetailHomeRoute", new { uid = ViewData["MemId"], isEditMode = true }) %>">
                            <img src="/../Content/Images/icon_newpost.gif" />
                            Chỉnh sửa danh mục </a>
                    </div>
                </div>
                <div class="private_write_right">
                    <div class="private_bt_newspost">
                        <a href="<%=Url.Action("Index", "Product" , new { uid = ViewData["MemId"]}) %>">
                            <img src="/../Content/Images/icon_newpost.gif" />
                            Đăng tải sản phẩm </a>
                    </div>
                </div>
                <% }
                   }%>
            </div>
            <div class="private_comment_top">
                <!-- ================================================================== -->
                <% 
                    if (Session["MemId"]!=null && hMem.Member.MemId==(int)Session["MemId"])
                    {
                        if (ViewData["ListCates"] != null)
                        {
                            Response.Write("<form action=" + Url.Action("list", "Product", new { uid = ViewData["MemId"], isEditMode = ViewData["isEditMode"] }) + " method='post' enctype='multipart/form-data'>");
                            Response.Write("<table>");
                            int rowPerCol = 3;
                            int count = 1;
                            //int k = -2;
                            //string []arr = new MemberHelper().getMember(int.Parse(Session["MemId"] + "")).MemCategoryList.Split(',');
                            for (int j = 1; j <= 12; j++)
                            {
                                if (count == 1)
                                    Response.Write("<tr><td>");
                                Response.Write(Html.DropDownList("drop_" + j, (SelectList)ViewData["ListCates"], new { style = "width:165px" }));
                                if (j % rowPerCol == 0)
                                {
                                    Response.Write("</td></tr>");
                                    count = 0;
                                }
                                count++;
                            }
                            Response.Write("<tr><td><input type='submit' id='submit' value='Hoàn tất' class='private_bt_submit_news' style='width:90px;'/></td></tr>");
                            Response.Write("</table></form>");
                        }

                        else
                        {
                            Response.Write("<div class='private_menu_list_product'> Không load được dữ liệu</div>");
                        }
                    }
                    else ViewData["Mode"] = "Showing";
                    {
                        int uid = ViewData["MemId"] == null ? -1 : (int)ViewData["MemId"];
                        if (ViewData["ListLinks"] != null)
                        {
                            List<Category> list = (List<Category>)ViewData["ListLinks"];
                            int rowPerCol = 4;
                            int count = 1;
                            for (int j = 1; j <= list.Count; j++)
                            {
                                if (count == 1)
                                {
                                    Response.Write("<div class='private_menu_list_product'><ul>");
                                    Response.Write("<li>" + Html.ActionLink("Không Hiển Thị", "List", "Product", new { uid = uid, cateId = -1, isEditMode = false }, null) + "</li>");
                                }
                                Response.Write("<li>" + Html.ActionLink(list[j - 1].CateName, "List", "Product", new { uid = uid, cateId = list[j - 1].CateId, isEditMode = false }, null) + "</li>");
                                if (j % rowPerCol == 0 && j != 0)
                                {
                                    Response.Write("</ul></div>");
                                    count = 0;
                                }
                                count++;
                            }
                        }
                    }
                %>
                <!-- ================================================================== -->
                <div class="clear">
                </div>
            </div>
            <hr class="private_color_hr" />
            <%
                if (ViewData["ListNewsProduct"] != null)
                {
                    int i;
                    NewsProductHelper.FetchProductResult lstNews = (NewsProductHelper.FetchProductResult)ViewData["ListNewsProduct"];

                    if (lstNews.products.Count > 0)
                    {
                        foreach (var item in lstNews.products)
                        {
                            WebHoiChoMuaBan.Controllers.Helpers.NewsProductThumbHelper proThumbHelper = new WebHoiChoMuaBan.Controllers.Helpers.NewsProductThumbHelper();
                            NewsProductThumb newsThumb = proThumbHelper.getProductMainThumbById(item.NProId) == null ? null : proThumbHelper.getProductMainThumbById(item.NProId);
                            Response.Write("<div class='private_thumb_listpr'>");
                            Response.Write("<div class='private_img_post_bt'>");
                            if (newsThumb != null)
                            {
                                Response.Write("<img src='/../Content/Images/Upload/" + newsThumb.NProThumbName + "' class='private_img_post' width='140px' height='100px'/></div>");
                            }
                            else
                                Response.Write("<img src='/../Content/Images/Upload/img_list_product.gif' class='private_img_post' width='140px' height='100px'/></div>");
                            Response.Write("<div class='private_post_text'>");
                            Response.Write("<a href='/Product/Details?id=" + item.NProId + "&uid=" + item.MemId + "'><p class='private_text_title'>" + item.NProTitle + "</p></a>");
                            //Response.Write("<p>" + item.NProIntro);
                            Response.Write("<br /><strong>Giá bán: </strong>&nbsp;<span class='private_price'>" + String.Format("{0:0,0}", item.NProPrice) + " " + item.NProPriceUnit + "</span></p><br />");
                            Response.Write("<div class='private_listpr_active'>");
                            Response.Write("<p class='private_timer'>(Hcm: 22/10/2011)&nbsp;</p>");
                            Response.Write("<div class='private_upload_newshot'>");
                            Response.Write("<a href='javacript:void(0)' onclick = 'return ShowOrHide_PostingHotNews(\"show\")' > <img src='/../Content/Images/upnewshot.gif' alt='' /></a></div>");
                            Response.Write("<div id='LikeField_" + item.NProId + "'>Thích: Có " + item.NProLike + " người thích </div>");
                            Response.Write("</div><br /");
                            Response.Write("<span><img src='/../Content/Images/turnview.gif'>&nbsp;&nbsp;Lượt xem: 250</span> <span> ");

                            if (Session["MemId"] != null && int.Parse(Session["MemId"] + "") != hMem.Member.MemId)
                            {
                                Response.Write("<a href='#noibat' class='hoicho_bt_action' onclick='LikeCLick(" + item.NProId + ")' id='LikeButton' data-url='" + item.NProId + "'>");
                                Response.Write("<img class='hoicho_bt_action_image ' style='cursor: pointer' align='middle' src='/../Content/Images/like_bt.gif' />Thích</a>");
                                Response.Write("<img src='/../Content/Images/comments_bt.gif' onclick='RegisterReplyButtonMemNews(" + item.NProId + ")' >&nbsp;&nbsp;Bình luận</span>");
                            }
                            else
                            {
                                Response.Write("Đăng nhập để like và bình luận");
                            }
                            Response.Write("  <a class='a2a_dd' href='http://www.addtoany.com/share_save?linkurl=hoichomuaban.com&amp;linkname=Hoi%20Cho%20Mua%20Ban'>");
                            Response.Write(" Share</a> <span class='a2a_divider'></span><a class='a2a_button_facebook'></a>");
                            Response.Write(" <a class='a2a_button_twitter'></a><a class='a2a_button_google_bookmarks'></a><a class='a2a_button_digg'>");
                            Response.Write("   </a> ");
            %>
            <form action="<%=Url.Action("AddComment", "NewsProduct") %>" id="formReplyNews_<%=item.NProId %>"
            method="post" class="private_content_comment hidden">
            <input type="hidden" value="<%=item.NProId %>" name="newsId" id="newsId" />
            <div class="private_menu_topmenu">
                <textarea class="input_full" rows="5" cols="45" id="Textarea2" name="txtComment"></textarea>
            </div>
            <div class="private_post_text">
                <div class="private_button_left">
                    <span class="private_font_bold">Chọn icon: </span>
                    <% ChatHelper chat = new ChatHelper();
                       List<ChatEmotionDetail> icons = chat.getEmotionPath();
                       foreach (ChatEmotionDetail icon in icons)
                       {
                           Response.Write("<img align='middle' onclick='MemchatIconClick(this)' src='" + icon.path + "' id='" + icon.notation + "' width='40px' height='40px' />");

                       }
                    %>
                    <script type="text/javascript">
                        function MemchatIconClick(obj) {
                            $this = document.getElementById("txtComment");
                            $this.value += obj.id;
                        }
                    </script>
                </div>
                <div class="private_write_right">
                    <input type="submit" style="#width: 60px;" id="Submit3" value="Gửi" class="private_bt_submit_news_disable" />
                </div>
            </div>
            </form>
        </div>
    </div>
    <%
}
                    }
                    else
                    {
                        Response.Write("Chưa có sản phẩm nào");
                    }
                            
    %>
    <center>
        <div class="private_breakpage">
            <%
                int p;
                if (Request.QueryString["p"] == null && !int.TryParse(Request.QueryString["p"], out p))
                {
                    p = 1;
                }
                else p = int.Parse(Request.QueryString["p"]);
            %>
            <% if (p > 1)
               { %><a href='<%=string.Format("{0}?p={1}#noibat'",
                                                       Url.RouteUrl("PrivateDefaultRoute1", new { uid = ViewData["MemId"], isEditMode = ViewData["isEditMode"] }),
                                                        p-1) %>'><img src="/../Content/Images/arrow_breakpage_left.gif" alt="">&nbsp;Trang
                   trước</a>
            <% } %>
            <%
                if (p > 3)
                    Response.Write(string.Format("<a href='{0}?p={1}#noibat'{2}>{3}</a> ",
                                                    Url.RouteUrl("PrivateDefaultRoute1", new { uid = ViewData["MemId"], isEditMode = ViewData["isEditMode"] }),
                                                    1,
                                                    string.Empty,
                                                     1));
                if (p > 4)
                    Response.Write("...");
                int total = lstNews.totalPages;
                int from = (p - 2 < 1 ? 1 : p - 2);
                int to = (p + 2 >= total ? total : p + 2);
                for (i = from; i <= to; i++)
                    Response.Write(string.Format("<a href='{0}?p={1}#noibat'{2}>{3}</a> ",
                        //Url.Action("List", "Product",new { uid = ViewData["MemId"],isEditMode =  Session["isEditMode"]}),
                                                    Url.RouteUrl("PrivateDefaultRoute1", new { uid = ViewData["MemId"], isEditMode = ViewData["isEditMode"] }),
                                                    i,
                                                    (i == p ? "class='menu_select'" : string.Empty),
                                                     i));
                if (p <= total - 4)
                    Response.Write("...");
                if (p <= total - 3)
                    Response.Write(string.Format("<a href='{0}?p={1}#noibat'{2}>{3}</a> ",
                                                    Url.RouteUrl("PrivateDefaultRoute1", new { uid = ViewData["MemId"], isEditMode = ViewData["isEditMode"] }),
                                                    total,
                                                    string.Empty,
                                                    total));
            %>
            <% if (p < lstNews.totalPages)
               { %><a href='<%=string.Format("{0}?p={1}#noibat'",
                                                      Url.RouteUrl("PrivateDefaultRoute1", new { uid = ViewData["MemId"], isEditMode = ViewData["isEditMode"] }),
                                                        p+1) %>'>Trang sau&nbsp;<img src="/../Content/Images/arrow_breakpage_right.gif" alt=""></a>
            <% }
                }
                else
                {
                    Response.Write("Chưa có sản phẩm nào");
                }%>
        </div>
    </center>
    </div>
    <!-- End danh mục san pham -->
    <!-- gioi thieu chung-->
    <div class="private_share_post">
        <div class="private_share_post_top">
            <div class="private_sharepost_menu">
                <ul>
                    <li><a class="menu_select" href="#">Giới thiệu chung</a></li>
                </ul>
            </div>
            <div class="private_write_right" style="margin: 5px;">
                <a href="#bando" onclick="initialize('<%=hMem.Member.MemFullname %>','<%=hMem.Member.MemAvatar %>')">
                    <img src="/../Content/Images/viewmap.gif"></a>
            </div>
        </div>
        <div class="private_comment_top">
            <p class="private_text_title">
                <%= hMem.Member.MemCompany == "" ? "Chưa cập nhật thông tin tên công ty" : hMem.Member.MemCompany%></p>
            <p>
                <%= hMem.Member.MemCompanyIntro == "" ? "Chưa cập nhật thông tin giới thiệu về công ty" : hMem.Member.MemCompanyIntro%></p>
        </div>
        <div id="memAddLat" class="hidden">
            <%=hMem.Member.MemAddressLatitude%></div>
        <div id="memAddLong" class="hidden">
            <%=hMem.Member.MemAddressLongitude%></div>
        <p class="private_font_bold">
            Xác định vị trí trên bản đồ (Google Map)</p>
        <div id="map_canvas" style="width: 500px; height: 300px">
        </div>
        <div class="private_img_footer">
            <p class="private_text_title">
                Địa chỉ liên lạc</p>
            <p>
                <%= hMem.Member.MemAddress == null ? "Chưa đăng ký địa chỉ" : hMem.Member.MemAddress + ", " +hMem.Member.Province.ProvName %><br />
                Tel:
                <%= hMem.Member.MemHomePhone == "" ? "Chưa đăng ký" : hMem.Member.MemHomePhone%>,
                Fax:
                <%= hMem.Member.MemFax == "" ? "Chưa đăng ký" : hMem.Member.MemFax%><br />
                Phone :
                <%= hMem.Member.MemCellPhone == "" ? "Chưa đăng ký" : hMem.Member.MemCellPhone %>
            </p>
        </div>
    </div>
    </div>
    <!-- End gioi thieu chung-->
    </div>
    <!-- Form chi tiết về việc đăng tin -->
    <%--   <div class="private_info_product">
        <div class="private_post_product_popuptop">
            <p class="private_text_record">
                Số điểm của bạn còn: 150</p>
            <div class="private_view_all" style="margin-top: 0">
                <div class="private_img_footer">
                    <a href="javascript:void(0)" onclick="ShowOrHide_PostingHotNews('hide')">Đóng cửa sổ
                        <img src="/../Content/Images/delete_bt.gif" alt=""></a></div>
            </div>
        </div>
        <div class="private_info_location_news">
            <table border="0" width="100%">
                <tr>
                    <td colspan="4" class="private_font_bold">
                        Chọn vị trí đăng tin
                    </td>
                </tr>
                <tr>
                    <td width="23%">
                        <p>
                            Trang chủ</p>
                        <input type="text" name="textfield3" id="textfield3" class="input_full" />
                    </td>
                    <td width="29%">
                        <p>
                            Trang danh mục chuyên đề</p>
                        <input type="text" name="textfield" id="textfield" class="input_full" />
                    </td>
                    <td width="28%">
                        <p>
                            Trang chuyên đề chi tiết</p>
                        <input type="text" name="textfield2" id="textfield2" class="input_full" />
                    </td>
                    <td width="20%">
                        <p>
                            Tổng điểm phải trả</p>
                        <input type="text" name="textfield4" id="textfield4" class="input_full" />
                    </td>
                </tr>
                <tr>
                    <td colspan="3">
                        Thời gian lặp lại:
                        <input type="checkbox" name="checkbox4" id="checkbox4" />1h
                        <label for="checkbox4">
                            <input type="checkbox" name="checkbox" id="checkbox" />
                            6h
                            <input type="checkbox" name="checkbox2" id="checkbox2" />
                            12h
                            <input type="checkbox" name="checkbox3" id="checkbox3" />
                            24h
                        </label>
                    </td>
                    <td align="right">
                        <div class="private_margin_topright private_write_right">
                            <input type="submit" class="private_bt_submit_news" value="Đăng quảng cáo" id="">
                        </div>
                    </td>
                </tr>
            </table>
        </div>
        <div class="private_img_footer">
            <div class="private_bt_member_left">
                <p class="private_font_bold">
                    Chi phí cho mỗi lần xuất hiện:</p>
                <p>
                    Trang chủ 6 điểm, Trang chuyên đề 4 điểm, Trang chuyên đề chi tiết 2 điểm</p>
            </div>
            <div class="private_view_all">
                <div class="private_margin_topright private_write_right">
                    <input type="submit" value="Mua thêm điểm đăng tin" class="private_bt_submit_news_disable"
                        id="">
                </div>
            </div>
        </div>
    </div>--%>
</asp:Content>
